package com.lookme.lmtool.cracker.filter.color;
import com.jhlabs.image.ContrastFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_COLOR,name="对比度调整",filterClass = ContrastFilter.class)
public class FilterContrast extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "亮度", desc = "亮度",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.1,majorTickUnit = 30,minorTickCount = 5)
    private float brightness=1.5f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "对比度", desc = "对比度",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 0.1,majorTickUnit = 30,minorTickCount = 5)
    private float contrast=2.0f;

    @Override
    public BufferedImageOp getFilter() {
        ContrastFilter filter=new ContrastFilter();
        filter.setBrightness(brightness);
        filter.setContrast(contrast);
        return filter;
    }

}
